/**
 * 功能:
 * 作者:周逸健
 * 日期: 2023/11/2 14:05
 */
package com.cgnfz.crm.entity;

import lombok.Data;
import org.springframework.security.core.CredentialsContainer;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Set;

@Data
public class Employee implements UserDetails, CredentialsContainer {

    private final boolean accountNonExpired;
    private final boolean accountNonLocked;
    private final boolean credentialsNonExpired;
    private final boolean enabled;
    String employeeId;
    String employee;
    String rule;
    String password;
    private Set<GrantedAuthority> authorities;

    /**
     *
     */
    @Override
    public void eraseCredentials() {
        this.password = null;
    }

    /**
     * @return
     */
    @Override
    public String getUsername() {
        return this.employee;
    }

    /**
     * @return
     */
    @Override
    public boolean isAccountNonExpired() {
        return this.accountNonExpired;
    }

    /**
     * @return
     */
    @Override
    public boolean isAccountNonLocked() {
        return this.accountNonLocked;
    }

    /**
     * @return
     */
    @Override
    public boolean isCredentialsNonExpired() {
        return this.credentialsNonExpired;
    }

    /**
     * @return
     */
    @Override
    public boolean isEnabled() {
        return this.enabled;
    }
}
